﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace MoControls.Controls
{
    /// <summary>
    /// Base abstract class for all UI elements. 
    /// </summary>
    public abstract class UIElement
        :IDisposable
    {
        #region Fields

        private IUIManager manager;
        private bool initialized = false;
        private bool disposed;

        protected bool isVisible = true;
        protected bool isEnabled = true;
        protected bool canFocus = false;
        protected bool suspended = false;

        #endregion

        #region Properties

        public virtual IUIManager Manager
        {
            get
            {
                return this.manager;
            }
            set
            {
                this.manager = value;
            }
        }

        public virtual bool Initialized
        {
            get
            {
                return this.initialized;
            }
        }

        public bool Disposed
        {
            get
            {
                return this.disposed;
            }
        }

        #endregion

        #region Methods

        #region Dispoable

        protected virtual void OnDispose()
        {
            this.disposed = true;
        }

        public void Dispose()
        {
            if (this.disposed == false)
                this.OnDispose();
        }

        #endregion

        #endregion
    }
}
